package cn.dengta.webapp.user.entity;

import java.util.Date;

import cn.dengta.common.model.ValueProxyImpl;
import cn.dengta.context.model.WesKit;
import cn.dengta.webapp.base.entity.BizEntity;
import cn.dengta.webapp.user.model.ComplainStatus;
import cn.dengta.webapp.user.model.Gender;
import lombok.Getter;
import lombok.Setter;
import lombok.experimental.Accessors;
import me.codeplayer.util.StringUtil;

/**
 * 举报信息
 *
 * @author lgy
 * @since 2022-03-01
 */
@Getter
@Setter
@Accessors(chain = true)
public class Complain extends BizEntity {

	/** 举报人 */
	private Long userId;
	/** 被举报人 */
	private Long toUserId;
	/** 举报类型 */
	private Long typeId;
	/** 内容 */
	private String content;
	/** 操作目标类型 */
	private String assocType;
	/** 操作目标ID */
	private Long assocId;
	/** 0-待处理，1-已删除/已警告，2-已忽略,3-已禁用 */
	/** 审核人 */
	protected Long verifyUserId;
	/** 审核时间 */
	protected Date verifyTime;
	/** 信息 */
	protected String verifyRemark;
	/** 图片地址 */
	private String images;
	/** 马甲包 */
	public WesKit wesKit;
	/** 性别 */
	public transient Gender gender;
	/** 昵称 */
	public transient String nickname;
	public transient Long agentId;
	public transient Long channelId;

	public void setId(Long id) {
		this.id = id;
	}

	public Complain init(Complain input, Date now) {
		this.userId = input.userId;
		this.toUserId = input.toUserId;
		this.typeId = input.typeId;
		this.content = StringUtil.toString(input.content);
		this.assocType = StringUtil.toString(input.assocType);
		this.assocId = input.assocId;
		this.verifyRemark = StringUtil.toString(verifyRemark);
		this.images = StringUtil.toString(input.images);
		super.init(input.status, input.state);
		super.initTime(now);
		return this;
	}

	public boolean canVerify() {
		return ComplainStatus.PENDING.eq(status);
	}

}
